package org.yscz.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 图片映射地址
 */
@Configuration
public class ImgHandlerConfig implements WebMvcConfigurer {
    @Value("${yscz.pictures.upload.location}")
    private String location;

    @Value("${yscz.pictures.abnormal.location}")
    private String abnormalLocation;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //文件图片url映射
        registry.addResourceHandler("/uploadFile/**").addResourceLocations("file:" + location)
        .addResourceLocations("file:" + abnormalLocation);
    }
}